package com.photoeditor.demo.db;

import com.photoeditor.demo.util.MediaTypeUtil;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;

/**
 * 用于保存已筛查过是否face的图片信息
 */
@Entity
public class FaceImgBean {
    @Id(autoincrement = true)
    private Long id;
    @Unique
    private String path;//索引
    private boolean isFace;
//    @Property
//    @Convert(converter = ThumbnailBeanConverter.class, columnType = String.class)
//    private ThumbnailBean bean;

    private long mDate;
    private boolean isChecked = false;
    private String mStringUri;
    private int mDegree = 0;
    private int mType = MediaTypeUtil.TYPE_OTHER_IMAGE;
    private long mDuration;
    private int mSelectCount = 0;
    @Generated(hash = 856359372)
    public FaceImgBean(Long id, String path, boolean isFace, long mDate, boolean isChecked, String mStringUri, int mDegree, int mType,
            long mDuration, int mSelectCount) {
        this.id = id;
        this.path = path;
        this.isFace = isFace;
        this.mDate = mDate;
        this.isChecked = isChecked;
        this.mStringUri = mStringUri;
        this.mDegree = mDegree;
        this.mType = mType;
        this.mDuration = mDuration;
        this.mSelectCount = mSelectCount;
    }
    @Generated(hash = 561656957)
    public FaceImgBean() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPath() {
        return this.path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public boolean getIsFace() {
        return this.isFace;
    }
    public void setIsFace(boolean isFace) {
        this.isFace = isFace;
    }
    public long getMDate() {
        return this.mDate;
    }
    public void setMDate(long mDate) {
        this.mDate = mDate;
    }
    public boolean getIsChecked() {
        return this.isChecked;
    }
    public void setIsChecked(boolean isChecked) {
        this.isChecked = isChecked;
    }
    public String getMStringUri() {
        return this.mStringUri;
    }
    public void setMStringUri(String mStringUri) {
        this.mStringUri = mStringUri;
    }
    public int getMDegree() {
        return this.mDegree;
    }
    public void setMDegree(int mDegree) {
        this.mDegree = mDegree;
    }
    public int getMType() {
        return this.mType;
    }
    public void setMType(int mType) {
        this.mType = mType;
    }
    public long getMDuration() {
        return this.mDuration;
    }
    public void setMDuration(long mDuration) {
        this.mDuration = mDuration;
    }
    public int getMSelectCount() {
        return this.mSelectCount;
    }
    public void setMSelectCount(int mSelectCount) {
        this.mSelectCount = mSelectCount;
    }

    //***ThumbnailBean的Uri为抽类象，不能被实例化。GSON转对象时报错：Can't instantiate abstract class android.net.Uri.......直接把ThumbnailBean的成员定义在此类,uri改为string
//    public static class ThumbnailBeanConverter implements PropertyConverter<ThumbnailBean, String> {
//        @Override
//        public ThumbnailBean convertToEntityProperty(String databaseValue) {
//            if (databaseValue == null) {
//                return null;
//            }
//            return new Gson().fromJson(databaseValue, ThumbnailBean.class);
//        }
//        @Override
//        public String convertToDatabaseValue(ThumbnailBean entityProperty) {
//            if (entityProperty == null) {
//                return null;
//            }
//            return new Gson().toJson(entityProperty);
//        }
//    }
}
